import VueRouter from 'vue-router'
import Home from '../pages/Home'
import Team from '../pages/Team'
import Achievement from '../pages/Achievement'
import Activity from '../pages/Activity'
import Contact from '../pages/Contact'
import Login from '../pages/Login'
import Menu from '../pages/Menu'
import Admin from '../pages/Admin'

const router = new VueRouter({
    routes: [
        {
            path: '/',
            redirect: '/Menu/Home',
        },
        {
            path: '/Login',
            name: 'Login',
            component: Login
        },
        {
            path: '/admin',
            name: 'Admin',
            component: Admin
        },
        {
            path: '/Menu',
            component: Menu,
            children: [
                {
                    path: 'Home',
                    component: Home
                },
                {
                    path: 'Team',
                    component: Team
                },
                {
                    path: 'Achievement',
                    component: Achievement
                },
                {
                    path: 'Activity',
                    component: Activity
                },
                {
                    path: 'Contact',
                    component: Contact
                }
            ]
        },
    ]
});

// router.beforeEach((to, from, next) => {
//     console.log(from.path);
//     if (from.path === '/admin') {
//         setTimeout(() => {
//             this.$EventBus.$emit("logined");
//         }, 500);
//     }
//     next();
// });

export default router;